<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>layout 后台大布局 - Layui</title>
<link rel="stylesheet" href="/weixinapp/public/layui/layui/css/layui.css">
</head>
<body>
 <form class="layui-form" method="post" style="width:500px;margin-top:130px">
  <div class="layui-form-item">
    <label class="layui-form-label">账号</label>
    <div class="layui-input-block">
      <input type="text" name="title" lay-verify="required" autocomplete="off" value="<?php echo $admininfo['username']?>" class="layui-input" id="username">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">密码</label>
    <div class="layui-input-block">
      <input type="text" name="username" lay-verify="required" value="<?php echo $admininfo['password']?>" autocomplete="off" class="layui-input" id="password">
    </div>
  </div>
  <input type="hidden" id="adminid" value="<?php echo $admininfo['id'];?>">
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit="" lay-filter="demo1">确认修改</button>
    </div>
  </div>
</body>
</html>
<script type="text/javascript" src="/weixinapp/public/layui/layui/layui.js"></script>
<script>
  layui.use(['element'], function(){
  var element = layui.element;
});
  layui.use(['form', 'layedit', 'laydate','jquery'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate
  ,$ = layui.jquery;
  var index = parent.layer.getFrameIndex(window.name);
  form.on('submit(demo1)', function(data){
          var username = $('#username').val();
          var password = $('#password').val();
          var adminid = $('#adminid').val();
        $.ajax({
          url:"/weixinapp/public/index.php/admin/admin/dochangeadmin",
          type:'post',
          data:{'username':username,'password':password,'id':adminid},
          dataType:'json',
          success:function(data){
             if(data.code == 200){
               layer.msg(data.msg, {icon:1,time:1000},function(){
                parent.layer.close(index); //再执行关闭
            });
          }else{
            layer.msg(data.msg,{icon:2,time:1000},function(){
              window.location.reload();
            });
          }
          }
        })
        return false;
      });

})
</script>
